package com.ggkt.common.utils;
import com.github.pagehelper.Page;
import lombok.Data;
import java.io.Serializable;
import java.util.List;

@Data
public class PageBean<T> implements Serializable {
    //	private int code;
    //当前页
    private int pageNum;
    //总页数
    private int totalPage;
    //页记录数
    private int pageSize;
    //总条数
    private long total;
    //数据
    private List<T> rows;
    //排序
    private String orderBy;

    public PageBean(){
        super();
    }

    public PageBean(int pageNum,int pageSize,long total){
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.total = total;
        this.totalPage = (int)(total + pageSize-1)/pageSize;
    }
    public PageBean(Page page){
        this.pageNum = page.getPageNum();
        this.pageSize = page.getPageSize();
        this.total = page.getTotal();
        this.totalPage = page.getPages();
        this.rows = page.getResult();
    }

}
